﻿Imports FinanceiroBLL
Public Class ConsultaBancosFRM
    Dim objBLL As New BancosBLL()
    Dim filtro As Integer
    Public ret As String = ""
    Private Sub TSBCadastrar_Click(sender As System.Object, e As System.EventArgs) Handles TSBCadastrar.Click
        CadastrodeBancosFRM.ShowDialog()
        DGVDados.DataSource = objBLL.localizar()
        DGVDados.Refresh()
    End Sub
    Sub atualizar()
        Dim dt As New DataTable
        dt = objBLL.localizar()
        DGVDados.DataSource = dt
        DGVDados.Refresh()
        'DGVDados.DataSource = objBLL.localizar()
        'DGVDados.Refresh()
    End Sub
    Private Sub TSBVoltar_Click(sender As System.Object, e As System.EventArgs) Handles TSBVoltar.Click
        Me.Close()
    End Sub
    Private Sub ConsultaBancosFRM_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        CBFiltro.SelectedIndex = -1
        atualizar()
    End Sub
    
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim var As String
        var = Trim(TBFiltro.Text)
        If CBFiltro.SelectedItem = "Nome" Then
            DGVDados.DataSource = objBLL.localizar(var)
        End If
        If CBFiltro.SelectedItem = "Agência" Then
            DGVDados.DataSource = objBLL.localizaAgencia(var)
        End If
        If CBFiltro.SelectedItem = "Status" Then
            DGVDados.DataSource = objBLL.localizarAgStatus(var)
        End If
        DGVDados.Refresh()
    End Sub

    Private Sub TBFiltro_TextChanged(sender As System.Object, e As System.EventArgs) Handles TBFiltro.TextChanged
        If (CBFiltro.Text = "Nome") Then
            DGVDados.DataSource = objBLL.localizar(TBFiltro.Text)
        End If
    End Sub
End Class